import oss2
from oss2.credentials import EnvironmentVariableCredentialsProvider
import json

auth = oss2.Auth('LTAI5tBWSfGYWw9cveErF9iU', 'eUPnw9SrEgFpbxyZDBKfYckToZuAQN')

bucket = oss2.Bucket(auth, 'https://oss-cn-beijing.aliyuncs.com', 'zddsc')
# 以下示例用于资源拥有者（即UID为174649585760xxxx的Bucket Owner）通过Bucket Policy授权指定用户（UID为20214760404935xxxx的RAM用户）拥有列举examplebucket下所有文件的权限。
# policy_text = '{"Statement": [{"Effect": "Allow", "Action": ["oss:GetObject", "oss:ListObjects"], "Principal": ["20214760404935xxxx"], "Resource": ["acs:oss:*:174649585760xxxx:examplebucket/*"]}], "Version": "1"}'
policy_text  = '{}'
# 上传授权策略。
bucket.put_bucket_policy(policy_text)